<!DOCTYPE html>
<html lang="zh">
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="utf-8">
<title>iOS学习笔记-02集合 - 蔡华的博客</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">



    <meta name="description" content="2.集合 集合分为可变与不可变。  泛型，写法NSMutableArray&amp;lt;NSNumber*&amp;gt;* mutablearr = [NSMutableArray array];和NSMutableDictionary&amp;lt;NSString*, NSNumber*&amp;gt;* dic = [[NSMutableDictionary alloc] init];,目前会有warning提示如果类">
<meta name="keywords" content="iOS学习笔记">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS学习笔记-02集合">
<meta property="og:url" content="https://caihua.tech/2016/09/16/02集合/index.html">
<meta property="og:site_name" content="蔡华的博客">
<meta property="og:description" content="2.集合 集合分为可变与不可变。  泛型，写法NSMutableArray&amp;lt;NSNumber*&amp;gt;* mutablearr = [NSMutableArray array];和NSMutableDictionary&amp;lt;NSString*, NSNumber*&amp;gt;* dic = [[NSMutableDictionary alloc] init];,目前会有warning提示如果类">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://caihua.tech/images/og_image.png">
<meta property="og:updated_time" content="2019-07-13T08:04:04.247Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="iOS学习笔记-02集合">
<meta name="twitter:description" content="2.集合 集合分为可变与不可变。  泛型，写法NSMutableArray&amp;lt;NSNumber*&amp;gt;* mutablearr = [NSMutableArray array];和NSMutableDictionary&amp;lt;NSString*, NSNumber*&amp;gt;* dic = [[NSMutableDictionary alloc] init];,目前会有warning提示如果类">
<meta name="twitter:image" content="https://caihua.tech/images/og_image.png">







<link rel="icon" href="/images/log.png">


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.7.2/css/bulma.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,600|Source+Code+Pro">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@9.12.0/styles/idea.css">


    
    
    
    <style>body>.footer,body>.navbar,body>.section{opacity:0}</style>
    

    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/css/lightgallery.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/css/justifiedGallery.min.css">
    

    
    

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.css">


    
    
    
    

<link rel="stylesheet" href="/css/back-to-top.css">


    
    
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-86194707-1"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'UA-86194707-1');
</script>


    
    
    
    

    
    
<link rel="stylesheet" href="/css/progressbar.css">
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

    
    
    

    
    
    


<link rel="stylesheet" href="/css/style.css">
</head>
<body class="is-3-column">
    <nav class="navbar navbar-main">
    <div class="container">
        <div class="navbar-brand is-flex-center">
            <a class="navbar-item navbar-logo" href="/">
            
                <img src="/images/logo.png" alt="iOS学习笔记-02集合" height="28">
            
            </a>
        </div>
        <div class="navbar-menu">
            
            <div class="navbar-start">
                
                <a class="navbar-item" href="/">主页</a>
                
                <a class="navbar-item" href="/archives">归档</a>
                
                <a class="navbar-item" href="/categories">分类</a>
                
                <a class="navbar-item" href="/tags">标签</a>
                
                <a class="navbar-item" href="/about">我</a>
                
            </div>
            
            <div class="navbar-end">
                
                
                
                <a class="navbar-item search" title="搜索" href="javascript:;">
                    <i class="fas fa-search"></i>
                </a>
                
            </div>
        </div>
    </div>
</nav>
    
    <section class="section">
        <div class="container">
            <div class="columns">
                <div class="column is-8-tablet is-8-desktop is-6-widescreen has-order-2 column-main"><div class="card">
    
    <div class="card-content article ">
        
        <div class="level article-meta is-size-7 is-uppercase is-mobile is-overflow-x-auto">
            <div class="level-left">
                <time class="level-item has-text-grey" datetime="2016-09-15T19:32:23.000Z">2016-09-16</time>
                
                <div class="level-item">
                <a class="has-link-grey -link" href="/categories/移动开发/">移动开发</a>
                </div>
                
                
                
            </div>
        </div>
        
        <h1 class="title is-size-3 is-size-4-mobile has-text-weight-normal">
            
                iOS学习笔记-02集合
            
        </h1>
        <div class="content">
            <h2 id="2-集合"><a href="#2-集合" class="headerlink" title="2.集合"></a>2.集合</h2><ul>
<li><p>集合分为可变与不可变。</p>
</li>
<li><p>泛型，写法<code>NSMutableArray&lt;NSNumber*&gt;* mutablearr = [NSMutableArray array];</code>和<code>NSMutableDictionary&lt;NSString*, NSNumber*&gt;* dic = [[NSMutableDictionary alloc] init];</code>,目前会有warning提示如果类型不对。多参数泛型如下，第二行为Xcode的提示性代码。</p>
  <figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">NSMutableDictionary&lt;NSString*, NSNumber*&gt;* dic = [[NSMutableDictionary alloc] init];</span><br><span class="line">[dic addEntriesFromDictionary:&lt;#(nonnull NSDictionary&lt;NSString *,NSNumber *&gt; *)#&gt;]</span><br></pre></td></tr></table></figure>

</li>
</ul>
<p><font color="red">目前来看类型只能是Objective-C object或者block。</font></p>
<a id="more"></a>

<ul>
<li><h4 id="NSArray-原文"><a href="#NSArray-原文" class="headerlink" title="NSArray 原文"></a>NSArray <a href="http://www.jianshu.com/p/c8caa30afd9d" target="_blank" rel="noopener">原文</a></h4></li>
</ul>
<ol>
<li>NSArray特点:    一旦创建成功,内容不可改变，只能存放OC对象。 </li>
</ol>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">//1)创建一个空数组</span><br><span class="line"> NSArray *arr1 = [NSArray array];</span><br><span class="line"></span><br><span class="line"> //2)创建数组,只有一个元素</span><br><span class="line"> NSArray *arr2 = [NSArray arrayWithObject:@&quot;1&quot;];</span><br><span class="line"></span><br><span class="line"> //3)创建数组,有多个元素</span><br><span class="line"> // nil 表示数组赋值结束</span><br><span class="line"> // 常见写法</span><br><span class="line"> NSArray *arr3 = [NSArray arrayWithObjects:@&quot;one&quot;,@&quot;two&quot;,@1, nil];</span><br><span class="line">                 NSLog(@&quot;arr3 = %@&quot;,arr3);</span><br><span class="line"> //4)调用对象方法,创建数组</span><br><span class="line"> //nil Nil NULL  NSNULL</span><br><span class="line"> NSArray *arr4 = [[NSArray alloc] initWithObjects:@&quot;three&quot;,[NSNull null],@&quot;four&quot;, nil];</span><br><span class="line">                 NSLog(@&quot;arr4 = %@&quot;,arr4);</span><br><span class="line"> //5)用一个数组可以创建另外一个数组，修改一个数组中的数据不影响另一个数组。</span><br><span class="line"> NSArray *arr5 = [NSArray arrayWithArray:arr3];</span><br></pre></td></tr></table></figure>

<ol start="2">
<li>常用方法:</li>
</ol>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">NSArray* arr3 = [NSArray arrayWithObjects:@&quot;one&quot;, @&quot;two&quot;, @1, @&quot;three&quot;, nil];</span><br><span class="line">NSLog(@&quot;arr3 = %@&quot;, arr3);</span><br><span class="line"></span><br><span class="line">//1)获取数组的长度  count获取数组的元素的个数</span><br><span class="line">NSLog(@&quot;%ld&quot;, arr3.count);</span><br><span class="line"></span><br><span class="line">//2)根据下标,获取下标对应的对象</span><br><span class="line">NSLog(@&quot;%@&quot;, [arr3 objectAtIndex:3]);</span><br><span class="line"></span><br><span class="line">//3)返回元素的下标</span><br><span class="line">NSUInteger loc = [arr3 indexOfObject:@&quot;three&quot;];</span><br><span class="line">NSLog(@&quot;%ld&quot;, loc);</span><br><span class="line"></span><br><span class="line">//4)数组中是否包含了某个元素</span><br><span class="line">if ([arr3 containsObject:@&quot;four&quot;]) &#123;</span><br><span class="line"></span><br><span class="line">    NSLog(@&quot;包含此元素&quot;);</span><br><span class="line">&#125;</span><br><span class="line">else &#123;</span><br><span class="line"></span><br><span class="line">    NSLog(@&quot;不包含&quot;);</span><br><span class="line">&#125;</span><br><span class="line">NSLog(@&quot;arr5 = %@&quot;, arr5);</span><br></pre></td></tr></table></figure>

<ol start="3">
<li>简化形式</li>
</ol>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">//用简化的方式,来定义和访问数组元素</span><br><span class="line">//1)用简化的方式,定义数组</span><br><span class="line">//格式: @[ 数组元素 ]</span><br><span class="line">NSArray* arr = @[ @&quot;1&quot;, @&quot;one&quot;, @&quot;3&quot;, @4, @&quot;ONE&quot; ];</span><br><span class="line">NSLog(@&quot;arr = %@&quot;, arr);</span><br><span class="line"></span><br><span class="line">NSString* str = [arr objectAtIndex:2];</span><br><span class="line">NSLog(@&quot;%@&quot;, str);</span><br><span class="line"></span><br><span class="line">//2)用简化的方式访问数组元素</span><br><span class="line">str = arr[1]; //C语言形式的数组元素访问</span><br><span class="line">NSLog(@&quot;%@&quot;, str);</span><br></pre></td></tr></table></figure>

<ol start="4">
<li>遍历</li>
</ol>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">   //定义一个数组</span><br><span class="line">    NSArray* arr = @[ @&quot;one&quot;, @&quot;two&quot;, @&quot;three&quot;, @&quot;four&quot; ];</span><br><span class="line"></span><br><span class="line">    //对数组进行遍历</span><br><span class="line"></span><br><span class="line">    //1) 普通的方式,通过下标访问</span><br><span class="line">    for (int i = 0; i &lt; arr.count; i++) &#123;</span><br><span class="line">        NSLog(@&quot;-&gt; %@&quot;, arr[i]);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    //2) 快速枚举法 for循环的增强形式</span><br><span class="line">    for (NSString* str in arr) &#123;</span><br><span class="line">        NSLog(@&quot;---&gt; %@&quot;, str);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    //3) 使用block的方式,进行访问</span><br><span class="line">    //                               数组元素            元素下标     是否停止</span><br><span class="line">    //stop:YES  会停止, stop:NO 不会停止</span><br><span class="line">    [arr enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL* stop) &#123;</span><br><span class="line"></span><br><span class="line">        if (idx == 2) &#123;</span><br><span class="line"></span><br><span class="line">            *stop = YES; //停止  // break;</span><br><span class="line">        &#125;</span><br><span class="line">        else &#123;</span><br><span class="line"></span><br><span class="line">            NSLog(@&quot;idx = %ld,obj = %@&quot;, idx, obj);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    &#125;];</span><br><span class="line">    </span><br><span class="line">    //补充：OC1.0中的方法</span><br><span class="line">    id obj2;</span><br><span class="line">    NSEnumerator* enumerator = [arr objectEnumerator];</span><br><span class="line">    while ((obj2 = [enumerator nextObject]) != nil) &#123;</span><br><span class="line">        NSLog(@&quot;%@ &quot;, obj2);</span><br><span class="line">    &#125;</span><br><span class="line">```  </span><br><span class="line"></span><br><span class="line">5. 读写文件:</span><br><span class="line"> </span><br><span class="line"> - 写入</span><br></pre></td></tr></table></figure>

<p>   NSArray* array = [NSArray arrayWithObjects:@”one”, @”zbz”, @”cgx”, @”sb”, @”cjk”, @”senni”, nil];<br>    //把NSArray 中的内容,写入到文件中<br>    //arr.plist 一种特殊的文件格式<br>    BOOL isWrite = [array writeToFile:@”/Users/zhaoxiaohu/Desktop/arr.xml” atomically:YES];</p>
<pre><code>if (isWrite) {
    NSLog(@&quot;写入成功&quot;);
}</code></pre><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">- 读取</span><br></pre></td></tr></table></figure>

<p>   //从文件中,读取一个数组信息<br>  NSArray *readArr = [NSArray arrayWithContentsOfFile:@”/Users/zhaoxiaohu/Desktop/arr.xml”];</p>
<p>  NSLog(@”readArr = %@”,readArr);</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">  </span><br><span class="line">6. NSArray与字符串:</span><br><span class="line"></span><br><span class="line"> - 把数组拼接成为字符串</span><br></pre></td></tr></table></figure>

<p> //定义一个数组<br>  NSArray *arr = @[@1,@2,@3,@4];</p>
<p>  //1)需求: 把数组中的元素用 “-“ 连接起来<br>  //  [数组 componentsJoinedByString @”分隔符”];<br>  // 1-2-3-4<br>  NSString *str = [arr componentsJoinedByString:@”-“];<br>  NSLog(@”str = %@”,str);</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"> </span><br><span class="line">- 把字符串拆分为数组</span><br></pre></td></tr></table></figure>

<p>  //2) 给一个字符串,分割成一个数组<br>  // 400-800-12580   //取得 400    12580    800<br>  NSString *str2 = @”400-800-12580”;<br>  NSArray *arr2 = [str2 componentsSeparatedByString:@”-“];<br>  NSLog(@”%@”,[arr2 firstObject]);<br>  NSLog(@”%@”,[arr2 lastObject]);<br> NSLog(@”%@”,arr2[1]);<br> <figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"> </span><br><span class="line">- #### NSMutableArray	 </span><br><span class="line"> </span><br><span class="line"> - NSArray子类，内容可变，其余很多操作与NSArray一样。</span><br><span class="line">  </span><br><span class="line">```  </span><br><span class="line">  NSMutableArray&lt;NSNumber*&gt;* mutablearr = [NSMutableArray array];</span><br><span class="line"> [mutablearr addObject:[NSNumber numberWithInt:1]];</span><br></pre></td></tr></table></figure></p>
<ul>
<li>虽然有arrayWithCapacity这个方法，但是内容是可以超出设定的值的。应该仅仅是申请内存的需要，毕竟可变长度对于内存操作上比较麻烦。</li>
</ul>
<ul>
<li><h4 id="NSDictionary与NSMutableDictionary"><a href="#NSDictionary与NSMutableDictionary" class="headerlink" title="NSDictionary与NSMutableDictionary"></a>NSDictionary与NSMutableDictionary</h4><p>字典的核心在于key和value。</p>
</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br></pre></td><td class="code"><pre><span class="line">//创建字典</span><br><span class="line">   //1、使用类方法创建字典</span><br><span class="line">   //   字典初始化后，内部是无序的</span><br><span class="line">   NSDictionary* dict1 = [NSDictionary dictionaryWithObjectsAndKeys:@&quot;zhangsan&quot;, @&quot;zs&quot;, @&quot;lisi&quot;, @&quot;ls&quot;, nil];</span><br><span class="line"></span><br><span class="line">   //获取字典的长度</span><br><span class="line">   NSLog(@&quot;%ld&quot;, dict1.count);</span><br><span class="line">   //根据key获取 value 只获取zs</span><br><span class="line">   NSString* s = [dict1 objectForKey:@&quot;zs&quot;];</span><br><span class="line">   NSLog(@&quot;%@&quot;, s);</span><br><span class="line"></span><br><span class="line">   //2、快速创建字典  @&#123;key:value,key1:value1&#125;</span><br><span class="line">   // 在字典中，key值是不能够重复的，重复的时候不会报错</span><br><span class="line">   // 重复的只保留一个（第一次出现的那个）</span><br><span class="line">   NSDictionary* dict2 = @&#123; @&quot;zs&quot; : @&quot;zhangsan&quot;,</span><br><span class="line">       @&quot;ls&quot; : @&quot;lisi&quot;,</span><br><span class="line">       @&quot;zs&quot; : @&quot;fengjie&quot; &#125;;</span><br><span class="line">   NSLog(@&quot;%@&quot;, dict2);</span><br><span class="line"></span><br><span class="line">   //3、遍历</span><br><span class="line"></span><br><span class="line">   NSLog(@&quot;获取所有keys的遍历&quot;);</span><br><span class="line">   NSArray* keys = [dict2 allKeys];</span><br><span class="line">   for (NSInteger i = 0; i &lt; keys.count; i++) &#123;</span><br><span class="line">       NSLog(@&quot;key = %@  value = %@&quot;, (NSString*)keys[i], [dict2 objectForKey:keys[i]]);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line">   NSLog(@&quot;NSEnumerator遍历&quot;);</span><br><span class="line">   id key;</span><br><span class="line">   NSEnumerator* enumerator = [dict2 keyEnumerator];</span><br><span class="line">   while ((key = [enumerator nextObject]) != nil) &#123;</span><br><span class="line">       NSLog(@&quot;key = %@  value = %@&quot;, (NSString*)key, [dict2 objectForKey:key]);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line">   NSLog(@&quot;快速遍历&quot;);</span><br><span class="line">   for (id key in dict2) &#123;</span><br><span class="line">       NSLog(@&quot;key = %@  value = %@&quot;, (NSString*)key, dict2[key]);</span><br><span class="line">   &#125;</span><br><span class="line"></span><br><span class="line">   NSLog(@&quot;block遍历&quot;);</span><br><span class="line"></span><br><span class="line">   [dict2 enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL* _Nonnull stop) &#123;</span><br><span class="line">       NSLog(@&quot;key = %@  value = %@&quot;, key, obj);</span><br><span class="line">   &#125;];</span><br><span class="line"></span><br><span class="line">   //4、可变的字典</span><br><span class="line">   NSMutableDictionary* mDic = [NSMutableDictionary dictionaryWithDictionary:dict1];</span><br><span class="line"></span><br><span class="line">   //4.1 移除数据</span><br><span class="line">   [mDic setValue:nil forKey:@&quot;zs&quot;];</span><br><span class="line">   [mDic removeObjectForKey:@&quot;ls&quot;];</span><br><span class="line">   [mDic removeAllObjects];</span><br><span class="line">   //    [mDic removeObjectForKey:&lt;#(nonnull id)#&gt;];</span><br><span class="line"></span><br><span class="line">   //4.2 添加数据</span><br><span class="line">   [mDic setObject:@&quot;wei&quot; forKey:@&quot;hua&quot;];</span><br><span class="line">   [mDic setValue:@&quot;xing&quot; forKey:@&quot;zhong&quot;];</span><br><span class="line">   //4.3 改变数据</span><br><span class="line">   [mDic setObject:@&quot;lisi2222&quot; forKey:@&quot;ls&quot;];</span><br><span class="line"></span><br><span class="line">   NSLog(@&quot;遍历NSMutableDictionary&quot;);</span><br><span class="line">   [mDic enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL* _Nonnull stop) &#123;</span><br><span class="line">       NSLog(@&quot;key = %@  value = %@&quot;, key, obj);</span><br><span class="line">   &#125;];</span><br></pre></td></tr></table></figure>


<p>  注意setValue:forKey:这个方法，既可以添加数据也可以移除数据（当value是nil时）。</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">  /* Send -setObject:forKey: to the receiver, unless the value is nil, in which case send -removeObjectForKey:.</span><br><span class="line">*/</span><br><span class="line">- (void)setValue:(nullable ObjectType)value forKey:(NSString *)key;</span><br></pre></td></tr></table></figure>

<ul>
<li><h4 id="NSSet-amp-NSMutableSet-原文"><a href="#NSSet-amp-NSMutableSet-原文" class="headerlink" title="NSSet &amp; NSMutableSet 原文"></a>NSSet &amp; NSMutableSet <a href="http://www.jianshu.com/p/27daa0fa1b78" target="_blank" rel="noopener">原文</a></h4></li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br></pre></td><td class="code"><pre><span class="line">在Foundation框架中，提供了NSSet类，它是一组单值对象的集合，且NSSet实例中元素是无序，同一个对象只能保存一个。</span><br><span class="line">   </span><br><span class="line">   一.不可变集合NSSet</span><br><span class="line">   </span><br><span class="line">   1.NSSet的初始化</span><br><span class="line">   </span><br><span class="line">   创建一个集合</span><br><span class="line">   </span><br><span class="line">   NSSet *set1 = [[NSSet alloc] initWithObjects:@&quot;one&quot;, @&quot;two&quot;, nil];</span><br><span class="line">   </span><br><span class="line">   通过数组的构建集合</span><br><span class="line">   </span><br><span class="line">   NSArray *array = [NSArrayWithObjects:@&quot;1&quot;, @&quot;2&quot;, @&quot;3&quot;, nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set2 = [[NSSet alloc] initWithArray:array];</span><br><span class="line">   </span><br><span class="line">   通过已有集合构建集合</span><br><span class="line">   </span><br><span class="line">   NSSet *set3 = [[NSSet alloc] initWithSet:set2];</span><br><span class="line">   </span><br><span class="line">   2.NSSet常用方法</span><br><span class="line">   </span><br><span class="line">   集合中对象的个数</span><br><span class="line">   </span><br><span class="line">   int count = [set3 count];</span><br><span class="line">   </span><br><span class="line">   以数组的形式返回集合中所有的对象</span><br><span class="line">   </span><br><span class="line">   NSArray *allObjects = [set3 allObjects];</span><br><span class="line">   </span><br><span class="line">   返回集合中的任意一个对象</span><br><span class="line">   </span><br><span class="line">   id object = [set3 anyObject];</span><br><span class="line">   </span><br><span class="line">   判断两个集合的元素中有包含的对象，包含返回YES，否则为NO</span><br><span class="line">   </span><br><span class="line">   BOOL isContain = [set4 containsObject:@&quot;2&quot;];</span><br><span class="line">   </span><br><span class="line">   判断两个集合的元素是否有相等的对象，存在返回YES，否则为NO</span><br><span class="line">   </span><br><span class="line">   BOOL isIntersect = [set4 intersectsSet:set2];</span><br><span class="line">   </span><br><span class="line">   判断两个集合的元素是否完全匹配，匹配返回YES，否则为NO</span><br><span class="line">   </span><br><span class="line">   BOOL isEqual = [set4 isEqualToSet:set5];</span><br><span class="line">   </span><br><span class="line">   集合4是否是集合5的子集合，如果是返回YES，否则为NO</span><br><span class="line">   </span><br><span class="line">   BOOL isSubset = [set4 isSubsetOfSet:set5];</span><br><span class="line">   </span><br><span class="line">   创建一个新的集合2，集合2有两个对象</span><br><span class="line">   </span><br><span class="line">   NSSet *set1 = [NSSet setWithObjects:@&quot;a&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set2 = [set1 setByAddingObject:@&quot;b&quot;];</span><br><span class="line">   </span><br><span class="line">   通过已有的两个集合，创建新的一个集合</span><br><span class="line">   </span><br><span class="line">   NSSet *set7 = [NSSet setWithObjects:@&quot;a&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set8 = [NSSet setWithObjects:@&quot;z&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set9 = [set7 setByAddingObjectsFromSet:set8];</span><br><span class="line">   </span><br><span class="line">   通过已有的集合和数组对象，创建一个新的集合</span><br><span class="line">   </span><br><span class="line">   NSArray *array = [NSArray arrayWithObjects:@&quot;a&quot;,@&quot;b&quot;,@&quot;c&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set10 = [NSSet setWithObjects:@&quot;z&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   NSSet *set11 = [set10 setByAddingObjectsFromArray:array];</span><br><span class="line">   </span><br><span class="line">   二、可变集合NSMutableSet</span><br><span class="line">   </span><br><span class="line">   常用方法</span><br><span class="line">   </span><br><span class="line">   创建一个空的集合</span><br><span class="line">   </span><br><span class="line">   NSMutableSet *set1 = [NSMutableSet set];</span><br><span class="line">   </span><br><span class="line">   NSMutableSet *set2 = [NSMutableSet setWithObjects:@&quot;1&quot;,@&quot;2&quot;,nil]；</span><br><span class="line">   </span><br><span class="line">   NSMutableSet *set3 = [NSMutableSet setWithObjects:@&quot;a&quot;,@&quot;2&quot;,nil];</span><br><span class="line">   </span><br><span class="line">   集合2减去集合3中的元素，集合2最后元素只有1个</span><br><span class="line">   </span><br><span class="line">   [set2 minusSet:set3];</span><br><span class="line">   </span><br><span class="line">   集合2与集合3中元素的交集，集合2最后元素只有1个</span><br><span class="line">   </span><br><span class="line">   [set2 intersectSet:set3];</span><br><span class="line">   </span><br><span class="line">   集合2与集合3中的元素的并集，集合2最后元素只有3个</span><br><span class="line">   </span><br><span class="line">   [set2 unionSet:set3];</span><br><span class="line">   </span><br><span class="line">   将空集合1设置为集合3中的内容</span><br><span class="line">   </span><br><span class="line">   [set1 setSet:set3];</span><br><span class="line">   </span><br><span class="line">   根据数组的内容删除集合中的对象</span><br><span class="line">   </span><br><span class="line">   [set2 addObjectsFromArray:array];</span><br><span class="line">   </span><br><span class="line">   [set2 removeObject:@&quot;1&quot;];</span><br><span class="line">   </span><br><span class="line">   [set]2 removeAllObjects];</span><br></pre></td></tr></table></figure>

<ul>
<li><h4 id="关于遍历"><a href="#关于遍历" class="headerlink" title="关于遍历"></a>关于遍历</h4><ul>
<li>从NSArray的遍历中就可以看出目前基本有四种遍历方法，分别是for、快速遍历，OC1.0的Enumerator方法和block遍历。</li>
<li>对于这四种遍历来说，block应该是通用性最好的。NSArray往往需要下标值，而dictionary需要key和value，NSSet只是需要内容。对于不同的需求来说，前三个方法没有通用性。block方法为不同的集合有不同的实现方法，<code>enumerateObjectsUsingBlock</code>和<code>enumerateKeysAndObjectsUsingBlock</code>，而且提供了类似<code>enumerateKeysAndObjectsWithOptions</code>这样的方法，可以选择是反序遍历或者并发遍历。</li>
</ul>
</li>
<li><h4 id="关于NSNumber"><a href="#关于NSNumber" class="headerlink" title="关于NSNumber"></a>关于NSNumber</h4><p>在使用数组和字典时会发现其内容不能使用简单类型，比如int，float，bool类型等，此时就需要用到NSNumber了，通过转换保存数值到数组或者字典。当然也可以通过<code>@1</code>这样的形式来讲数值保存到数字或字典。</p>
</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">NSMutableArray* mutablearr = [NSMutableArray arrayWithArray:@[ @9, @8 ]];</span><br><span class="line">[mutablearr addObject:[NSNumber numberWithInt:1]];</span><br><span class="line">[mutablearr addObject:[NSNumber numberWithInt:2]];</span><br><span class="line">[mutablearr addObject:@1];</span><br></pre></td></tr></table></figure>

<ul>
<li><h4 id="NSCache"><a href="#NSCache" class="headerlink" title="NSCache"></a>NSCache</h4><p>缓存应该选择的数据类型，dictionary和array在iOS中并不是很好的缓存选择，更好的选择应该是NSCache。原因如下：</p>
<blockquote>
<p> 1.对于键值是retain而不是copy，这个是很dictionary本质的区别。</p>
<p> 2.线程安全，支持多线程操作。</p>
<p> 3.自己实现了很多控制性的功能，比如对象的多少，最大存储量(但是limits are imprecise/not strict，逗比！！！)，在内存不足（<code>didReceiveMemoryWarning</code>）时可以自动的删除，并且按照优先删除最久未使用的对象。  </p>
</blockquote>
<p>  <a href="http://www.jianshu.com/p/597012cef38e" target="_blank" rel="noopener">参考</a></p>
</li>
<li><h4 id="NSUserDefaults-原文"><a href="#NSUserDefaults-原文" class="headerlink" title="NSUserDefaults 原文"></a>NSUserDefaults <a href="http://my.oschina.net/u/1245365/blog/294449" target="_blank" rel="noopener">原文</a></h4><ul>
<li><p>了解NSUserDefaults以及它可以直接存储的类型</p>
<p>NSUserDefaults是一个单例，在整个程序中只有一个实例对象，他可以用于数据的永久保存，而且简单实用，这是它可以让数据自由传递的一个前提，也是大家喜欢用它保存简单数据的一个主要原因。     </p>
<p>使用 NSUserDefaults 存储自定义对象的最初，我们必须认识NSUserDefaults可以存储哪一些类型的数据，下面一一列出：</p>
<p>NSUserDefaults支持的数据类型有：NSNumber（NSInteger、float、double），NSString，NSDate，NSArray，NSDictionary，BOOL.</p>
<p>如果想要将上述数据类型的数据永久保存到NSUserDefaults中去，只需要简单的操作(一个Value 一个Key ),例如，想要保存一个NSString的对象，代码实现为：</p>
</li>
</ul>
</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">//将NSString 对象存储到 NSUserDefaults 中</span><br><span class="line">NSString *passWord = @&quot;1234567&quot;;</span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line">[user setObject:passWord forKey:@&quot;userPassWord&quot;];</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">将数据取出也很简单，只需要取出key 对应的值就好了，代码如下：</span><br><span class="line"></span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line">NSString *passWord = [ user objectForKey:@&quot;userPassWord&quot;];</span><br></pre></td></tr></table></figure>


<p><font color="red">注意：对相同的Key赋值约等于一次覆盖，要保证每一个Key的唯一性</font></p>
<pre><code>&lt;font color=red&gt;值得注意的是：&lt;/font&gt;
NSUserDefaults 存储的对象&lt;font color=red&gt;全是不可变的&lt;/font&gt;
（这一点非常关键，弄错的话程序会出bug），例如，如果我想要存储一个 NSMutableArray 对象，我必须先创建一个不可变数组（NSArray）再将它存入NSUserDefaults中去，代码如下：</code></pre><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">NSMutableArray *mutableArray = [NSMutableArray arrayWithObjects:@&quot;123&quot;,@&quot;234&quot;, nil];</span><br><span class="line">NSArray * array = [NSArray arrayWithArray:mutableArray];</span><br><span class="line">    </span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line">[user setObject:array forKey:@&quot;记住存放的一定是不可变的&quot;];</span><br></pre></td></tr></table></figure>


<pre><code>取出数据是一样的，想要用NSUserDefaults中的数据给可变数组赋值

先给出一个错误的写法：</code></pre><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">/*-------------------------错误的赋值方法-------------------*/</span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line"></span><br><span class="line">//这样写后，mutableArray 就变成了不可变数组了，如果你要在数组中添加或删除数据就会出现bug</span><br><span class="line">NSMutableArray *mutableArray = [user objectForKey:@&quot;记住存放的一定是不可变的&quot;];</span><br></pre></td></tr></table></figure>



<pre><code>正确的写法：</code></pre><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">/*-------------------------正确的赋值方法-------------------*/</span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line"></span><br><span class="line">//可以用alloc 方法代替</span><br><span class="line">NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:[user objectForKey:@&quot;记住存放的一定是不可变的&quot;]];</span><br></pre></td></tr></table></figure>

<ul>
<li><p>使用 NSUserDefaults 存储自定义对象</p>
<p>  1、将自定义类型转换为NSData类型</p>
<pre><code>当数据重复而且多的时候（例如想存储全班同学的学号，姓名，性别（这个数据量可能太大了 ）），如果不用SQLite 存储 （多数据最好还是用这个），你可以选择使用归档，再将文件写入本地，但是这种方式和 NSUserDefaults 比起来麻烦多了（因为NSFileManage 本来就挺复杂） ，但是问题是，NSUserDefaults 本身不支持自定义对象的存储，不过它支持NSData的类型，下面举一个例子来介绍。</code></pre></li>
</ul>
<pre><code>我们先建立一个叫Student 的类，这个类里有三个属性（学号，姓名，性别）,如图：

![](http://images2015.cnblogs.com/blog/23250/201610/23250-20161003181834145-1260516689.png)

我们要做的就是将Student类型变成NSData类型 ，那么就必须实现归档：

这里要实现 在.h 文件中申明 NSCoding 协议，再 在 .m 中实现 encodeWithCoder 方法 和 

initWithCoder 方法就可以了 ： 

.h 中修改文件如图 ：

![](http://images2015.cnblogs.com/blog/23250/201610/23250-20161003181857239-402489604.jpg)

.m中加入代码 ：

![](http://images2015.cnblogs.com/blog/23250/201610/23250-20161003181907192-668738465.png)

这样做就可以将自定义类型转变为NSData类型了



2、将自定义类型数据存入 NSUserDefaults 中

 如果要存储全班同学的信息，我们可以建一个NSMutableArray 来存放全班同学的信息（里面存储的全是NSData对象）在需要存储的地方加入代码：</code></pre><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">//首先，要建立一个可变数组来存储 NSDate对象</span><br><span class="line">Student* student = [[Student alloc] ini];</span><br><span class="line">//下面进行的是对student对象的 name ， studentNumber ，sex 的赋值</span><br><span class="line">student.name = @&quot;lady-奕奕&quot;;</span><br><span class="line">student.studentNumber = @&quot;3100104006&quot;;</span><br><span class="line">student.sex = @&quot;女&quot;;</span><br><span class="line"></span><br><span class="line">//这是一个存放全班同学的数组</span><br><span class="line">NSMutableArray* dataArray = [NSMutableArray arrayWithCapacity:50];</span><br><span class="line">//将student类型变为NSData类型</span><br><span class="line">NSData* data = [NSKeyedArchiver archivedDataWithRootObject:student];</span><br><span class="line">//存放数据的数组将data加入进去</span><br><span class="line">[dataArray addObject:data];</span><br></pre></td></tr></table></figure>


<p>如果你只想存一个人的信息，你可以直接将NSData存入NSUserDefaults中 :</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">NSData *data = [NSKeyedArchiver archivedDataWithRootObject:student];   </span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line">[user setObject:data forKey:@&quot;oneStudent&quot;];</span><br></pre></td></tr></table></figure>


<p>如果你想存储全班同学的信息，你还要用一个for循环将data 放入 dataArray中，这里具体的操作就不实现了，只给出存放的代码：</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">//记住要转换成不可变数组类型</span><br><span class="line">NSArray * array = [NSArray arrayWithArray:dataArray];</span><br><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line">[user setObject:array forKey:@&quot;allStudent&quot;];</span><br></pre></td></tr></table></figure>


<p>从NSUserDefaults中取出数据在还原也很简单。例如还原一个学生的数据：</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">NSUserDefaults *user = [NSUserDefaults standardUserDefaults];</span><br><span class="line"> </span><br><span class="line">NSdData *data = [user objectForKey:@&quot;oneStudent&quot;];</span><br><span class="line">    </span><br><span class="line">Student *student = [NSKeyedUnarchiver unarchiveObjectWithData:data];</span><br></pre></td></tr></table></figure>
        </div>
        
        <div class="level is-size-7 is-uppercase">
            <div class="level-start">
                <div class="level-item">
                    <span class="is-size-6 has-text-grey has-mr-7">#</span>
                    <a class="has-link-grey -link" href="/tags/iOS学习笔记/">iOS学习笔记</a>
                </div>
            </div>
        </div>
        
        
        
    </div>
    
</div>






<div class="card card-transparent">
    <div class="level post-navigation is-flex-wrap is-mobile">
        
        <div class="level-start">
            <a class="level level-item has-link-grey  article-nav-prev" href="/2016/09/22/解决JSONKit在macOS Sierra上crash的问题/">
                <i class="level-item fas fa-chevron-left"></i>
                <span class="level-item">解决JSONKit在macOS Sierra上crash的问题</span>
            </a>
        </div>
        
        
        <div class="level-end">
            <a class="level level-item has-link-grey  article-nav-next" href="/2016/09/16/05线程/">
                <span class="level-item">iOS学习笔记-05线程</span>
                <i class="level-item fas fa-chevron-right"></i>
            </a>
        </div>
        
    </div>
</div>


</div>
                




<div class="column is-4-tablet is-4-desktop is-3-widescreen  has-order-1 column-left ">
    
        
<div class="card widget">
    <div class="card-content">
        <nav class="level">
            <div class="level-item has-text-centered" style="flex-shrink: 1">
                <div>
                    
                        <img class="image is-128x128 has-mb-6" src="/images/avatar.png" alt="蔡华">
                    
                    
                    <p class="is-size-4 is-block">
                        蔡华
                    </p>
                    
                    
                    <p class="is-size-6 is-block">
                        游戏开发者
                    </p>
                    
                    
                    <p class="is-size-6 is-flex is-flex-center has-text-grey">
                        <i class="fas fa-map-marker-alt has-mr-7"></i>
                        <span>Xi&#39;an China</span>
                    </p>
                    
                </div>
            </div>
        </nav>
        <nav class="level is-mobile">
            <div class="level-item has-text-centered is-marginless">
                <div>
                    <p class="heading">
                        文章
                    </p>
                    <p class="title has-text-weight-normal">
                        137
                    </p>
                </div>
            </div>
            <div class="level-item has-text-centered is-marginless">
                <div>
                    <p class="heading">
                        分类
                    </p>
                    <p class="title has-text-weight-normal">
                        6
                    </p>
                </div>
            </div>
            <div class="level-item has-text-centered is-marginless">
                <div>
                    <p class="heading">
                        标签
                    </p>
                    <p class="title has-text-weight-normal">
                        18
                    </p>
                </div>
            </div>
        </nav>
        <div class="level">
            <a class="level-item button is-link is-rounded" href="https://github.com/klkucan" target="_blank">
                关注我</a>
        </div>
        
        
        <div class="level is-mobile">
            
            <a class="level-item button is-white is-marginless" target="_blank" title="Github" href="https://github.com/klkucan">
                
                <i class="fab fa-github"></i>
                
            </a>
            
        </div>
        
    </div>
</div>
    
        
    
        


    
        
<div class="card widget">
    <div class="card-content">
        <div class="menu">
            <h3 class="menu-label">
                分类
            </h3>
            <ul class="menu-list">
            <li>
        <a class="level is-marginless" href="/categories/杂记/">
            <span class="level-start">
                <span class="level-item">杂记</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">4</span>
            </span>
        </a></li><li>
        <a class="level is-marginless" href="/categories/游戏开发/">
            <span class="level-start">
                <span class="level-item">游戏开发</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">84</span>
            </span>
        </a></li><li>
        <a class="level is-marginless" href="/categories/移动开发/">
            <span class="level-start">
                <span class="level-item">移动开发</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">9</span>
            </span>
        </a></li><li>
        <a class="level is-marginless" href="/categories/编程语言/">
            <span class="level-start">
                <span class="level-item">编程语言</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">28</span>
            </span>
        </a></li><li>
        <a class="level is-marginless" href="/categories/计算机基础/">
            <span class="level-start">
                <span class="level-item">计算机基础</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">7</span>
            </span>
        </a></li><li>
        <a class="level is-marginless" href="/categories/软件设计/">
            <span class="level-start">
                <span class="level-item">软件设计</span>
            </span>
            <span class="level-end">
                <span class="level-item tag">5</span>
            </span>
        </a></li>
            </ul>
        </div>
    </div>
</div>
    
        
<div class="card widget">
    <div class="card-content">
        <h3 class="menu-label">
            标签云
        </h3>
        <a href="/tags/3D数学/" style="font-size: 10px;">3D数学</a> <a href="/tags/CPP/" style="font-size: 15.45px;">CPP</a> <a href="/tags/CPU/" style="font-size: 10px;">CPU</a> <a href="/tags/Engine/" style="font-size: 10.91px;">Engine</a> <a href="/tags/Java/" style="font-size: 18.18px;">Java</a> <a href="/tags/Lua/" style="font-size: 14.55px;">Lua</a> <a href="/tags/OpenGL/" style="font-size: 17.27px;">OpenGL</a> <a href="/tags/PHP/" style="font-size: 10px;">PHP</a> <a href="/tags/UWA/" style="font-size: 19.09px;">UWA</a> <a href="/tags/Unity3D/" style="font-size: 20px;">Unity3D</a> <a href="/tags/Unity預計算即時GI/" style="font-size: 11.82px;">Unity預計算即時GI</a> <a href="/tags/VR-AR/" style="font-size: 11.82px;">VR/AR</a> <a href="/tags/Vulkan/" style="font-size: 11.82px;">Vulkan</a> <a href="/tags/iOS学习笔记/" style="font-size: 16.36px;">iOS学习笔记</a> <a href="/tags/并发模型/" style="font-size: 13.64px;">并发模型</a> <a href="/tags/杂记/" style="font-size: 12.73px;">杂记</a> <a href="/tags/游戏设计模式/" style="font-size: 15.45px;">游戏设计模式</a> <a href="/tags/组成原理/" style="font-size: 14.55px;">组成原理</a>
    </div>
</div>

    
    
        <div class="column-right-shadow is-hidden-widescreen ">
        
            
<div class="card widget">
    <div class="card-content">
        <h3 class="menu-label">
            最新文章
        </h3>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-05-07T06:24:35.000Z">2021-05-07</time></div>
                    <a href="/2021/05/07/2021-5-7-TLSF-代码实现分析：1、创建内存池/" class="has-link-black-ter is-size-6">TLSF 代码实现分析：1、创建内存池</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-04-24T06:41:05.000Z">2021-04-24</time></div>
                    <a href="/2021/04/24/2021-4-24-TLSF笔记/" class="has-link-black-ter is-size-6">TLSF笔记</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-30T08:34:36.000Z">2021-01-30</time></div>
                    <a href="/2021/01/30/2021-1-30-OpenGL学习笔记：Compute-Shader/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Compute Shader</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-29T11:55:09.000Z">2021-01-29</time></div>
                    <a href="/2021/01/29/2021-1-29-OpenGL学习笔记：Subroutine/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Subroutine</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-27T11:55:09.000Z">2021-01-27</time></div>
                    <a href="/2021/01/27/2021-1-27-OpenGL学习笔记：Instance/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Instance</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
    </div>
</div>

        
            <div class="card widget">
    <div class="card-content">
        <div class="menu">
        <h3 class="menu-label">
            归档
        </h3>
        <ul class="menu-list">
        
        <li>
            <a class="level is-marginless" href="/archives/2021/05/">
                <span class="level-start">
                    <span class="level-item">五月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2021/04/">
                <span class="level-start">
                    <span class="level-item">四月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2021/01/">
                <span class="level-start">
                    <span class="level-item">一月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">8</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/09/">
                <span class="level-start">
                    <span class="level-item">九月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/03/">
                <span class="level-start">
                    <span class="level-item">三月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/02/">
                <span class="level-start">
                    <span class="level-item">二月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/09/">
                <span class="level-start">
                    <span class="level-item">九月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/08/">
                <span class="level-start">
                    <span class="level-item">八月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/07/">
                <span class="level-start">
                    <span class="level-item">七月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/06/">
                <span class="level-start">
                    <span class="level-item">六月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/05/">
                <span class="level-start">
                    <span class="level-item">五月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/04/">
                <span class="level-start">
                    <span class="level-item">四月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/03/">
                <span class="level-start">
                    <span class="level-item">三月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/02/">
                <span class="level-start">
                    <span class="level-item">二月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/10/">
                <span class="level-start">
                    <span class="level-item">十月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/09/">
                <span class="level-start">
                    <span class="level-item">九月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/08/">
                <span class="level-start">
                    <span class="level-item">八月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/07/">
                <span class="level-start">
                    <span class="level-item">七月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/05/">
                <span class="level-start">
                    <span class="level-item">五月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/04/">
                <span class="level-start">
                    <span class="level-item">四月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/03/">
                <span class="level-start">
                    <span class="level-item">三月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">4</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/02/">
                <span class="level-start">
                    <span class="level-item">二月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/01/">
                <span class="level-start">
                    <span class="level-item">一月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">8</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/10/">
                <span class="level-start">
                    <span class="level-item">十月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">7</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/09/">
                <span class="level-start">
                    <span class="level-item">九月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/08/">
                <span class="level-start">
                    <span class="level-item">八月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">10</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/07/">
                <span class="level-start">
                    <span class="level-item">七月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/06/">
                <span class="level-start">
                    <span class="level-item">六月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/04/">
                <span class="level-start">
                    <span class="level-item">四月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/03/">
                <span class="level-start">
                    <span class="level-item">三月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/02/">
                <span class="level-start">
                    <span class="level-item">二月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">5</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/10/">
                <span class="level-start">
                    <span class="level-item">十月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">4</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/09/">
                <span class="level-start">
                    <span class="level-item">九月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        </ul>
        </div>
    </div>
</div>
        
            <div class="card widget">
    <div class="card-content">
        <div class="menu">
            <h3 class="menu-label">
                标签
            </h3>
            <div class="field is-grouped is-grouped-multiline">
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/3D数学/">
                        <span class="tag">3D数学</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/CPP/">
                        <span class="tag">CPP</span>
                        <span class="tag is-grey">8</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/CPU/">
                        <span class="tag">CPU</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Engine/">
                        <span class="tag">Engine</span>
                        <span class="tag is-grey">2</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Java/">
                        <span class="tag">Java</span>
                        <span class="tag is-grey">13</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Lua/">
                        <span class="tag">Lua</span>
                        <span class="tag is-grey">6</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/OpenGL/">
                        <span class="tag">OpenGL</span>
                        <span class="tag is-grey">10</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/PHP/">
                        <span class="tag">PHP</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/UWA/">
                        <span class="tag">UWA</span>
                        <span class="tag is-grey">25</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Unity3D/">
                        <span class="tag">Unity3D</span>
                        <span class="tag is-grey">29</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Unity預計算即時GI/">
                        <span class="tag">Unity預計算即時GI</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/VR-AR/">
                        <span class="tag">VR/AR</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Vulkan/">
                        <span class="tag">Vulkan</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/iOS学习笔记/">
                        <span class="tag">iOS学习笔记</span>
                        <span class="tag is-grey">9</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/并发模型/">
                        <span class="tag">并发模型</span>
                        <span class="tag is-grey">5</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/杂记/">
                        <span class="tag">杂记</span>
                        <span class="tag is-grey">4</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/游戏设计模式/">
                        <span class="tag">游戏设计模式</span>
                        <span class="tag is-grey">8</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/组成原理/">
                        <span class="tag">组成原理</span>
                        <span class="tag is-grey">6</span>
                    </a>
                </div>
                
            </div>
        </div>
    </div>
</div>
        
        </div>
    
</div>

                




<div class="column is-4-tablet is-4-desktop is-3-widescreen is-hidden-touch is-hidden-desktop-only has-order-3 column-right ">
    
        
<div class="card widget">
    <div class="card-content">
        <h3 class="menu-label">
            最新文章
        </h3>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-05-07T06:24:35.000Z">2021-05-07</time></div>
                    <a href="/2021/05/07/2021-5-7-TLSF-代码实现分析：1、创建内存池/" class="has-link-black-ter is-size-6">TLSF 代码实现分析：1、创建内存池</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-04-24T06:41:05.000Z">2021-04-24</time></div>
                    <a href="/2021/04/24/2021-4-24-TLSF笔记/" class="has-link-black-ter is-size-6">TLSF笔记</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-30T08:34:36.000Z">2021-01-30</time></div>
                    <a href="/2021/01/30/2021-1-30-OpenGL学习笔记：Compute-Shader/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Compute Shader</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-29T11:55:09.000Z">2021-01-29</time></div>
                    <a href="/2021/01/29/2021-1-29-OpenGL学习笔记：Subroutine/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Subroutine</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
        <article class="media">
            
            <div class="media-content">
                <div class="content">
                    <div><time class="has-text-grey is-size-7 is-uppercase" datetime="2021-01-27T11:55:09.000Z">2021-01-27</time></div>
                    <a href="/2021/01/27/2021-1-27-OpenGL学习笔记：Instance/" class="has-link-black-ter is-size-6">OpenGL学习笔记：Instance</a>
                    <p class="is-size-7 is-uppercase">
                        <a class="has-link-grey -link" href="/categories/游戏开发/">游戏开发</a>
                    </p>
                </div>
            </div>
        </article>
        
    </div>
</div>

    
        <div class="card widget">
    <div class="card-content">
        <div class="menu">
        <h3 class="menu-label">
            归档
        </h3>
        <ul class="menu-list">
        
        <li>
            <a class="level is-marginless" href="/archives/2021/05/">
                <span class="level-start">
                    <span class="level-item">五月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2021/04/">
                <span class="level-start">
                    <span class="level-item">四月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2021/01/">
                <span class="level-start">
                    <span class="level-item">一月 2021</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">8</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/09/">
                <span class="level-start">
                    <span class="level-item">九月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/03/">
                <span class="level-start">
                    <span class="level-item">三月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2020/02/">
                <span class="level-start">
                    <span class="level-item">二月 2020</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/09/">
                <span class="level-start">
                    <span class="level-item">九月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/08/">
                <span class="level-start">
                    <span class="level-item">八月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/07/">
                <span class="level-start">
                    <span class="level-item">七月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/06/">
                <span class="level-start">
                    <span class="level-item">六月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/05/">
                <span class="level-start">
                    <span class="level-item">五月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/04/">
                <span class="level-start">
                    <span class="level-item">四月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/03/">
                <span class="level-start">
                    <span class="level-item">三月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2019/02/">
                <span class="level-start">
                    <span class="level-item">二月 2019</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/10/">
                <span class="level-start">
                    <span class="level-item">十月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/09/">
                <span class="level-start">
                    <span class="level-item">九月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/08/">
                <span class="level-start">
                    <span class="level-item">八月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/07/">
                <span class="level-start">
                    <span class="level-item">七月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/05/">
                <span class="level-start">
                    <span class="level-item">五月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/04/">
                <span class="level-start">
                    <span class="level-item">四月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/03/">
                <span class="level-start">
                    <span class="level-item">三月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">4</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/02/">
                <span class="level-start">
                    <span class="level-item">二月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/01/">
                <span class="level-start">
                    <span class="level-item">一月 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">8</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/10/">
                <span class="level-start">
                    <span class="level-item">十月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">7</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/09/">
                <span class="level-start">
                    <span class="level-item">九月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/08/">
                <span class="level-start">
                    <span class="level-item">八月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">10</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/07/">
                <span class="level-start">
                    <span class="level-item">七月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/06/">
                <span class="level-start">
                    <span class="level-item">六月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/04/">
                <span class="level-start">
                    <span class="level-item">四月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/03/">
                <span class="level-start">
                    <span class="level-item">三月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/02/">
                <span class="level-start">
                    <span class="level-item">二月 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">5</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/12/">
                <span class="level-start">
                    <span class="level-item">十二月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/11/">
                <span class="level-start">
                    <span class="level-item">十一月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/10/">
                <span class="level-start">
                    <span class="level-item">十月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">4</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2016/09/">
                <span class="level-start">
                    <span class="level-item">九月 2016</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        </ul>
        </div>
    </div>
</div>
    
        <div class="card widget">
    <div class="card-content">
        <div class="menu">
            <h3 class="menu-label">
                标签
            </h3>
            <div class="field is-grouped is-grouped-multiline">
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/3D数学/">
                        <span class="tag">3D数学</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/CPP/">
                        <span class="tag">CPP</span>
                        <span class="tag is-grey">8</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/CPU/">
                        <span class="tag">CPU</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Engine/">
                        <span class="tag">Engine</span>
                        <span class="tag is-grey">2</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Java/">
                        <span class="tag">Java</span>
                        <span class="tag is-grey">13</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Lua/">
                        <span class="tag">Lua</span>
                        <span class="tag is-grey">6</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/OpenGL/">
                        <span class="tag">OpenGL</span>
                        <span class="tag is-grey">10</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/PHP/">
                        <span class="tag">PHP</span>
                        <span class="tag is-grey">1</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/UWA/">
                        <span class="tag">UWA</span>
                        <span class="tag is-grey">25</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Unity3D/">
                        <span class="tag">Unity3D</span>
                        <span class="tag is-grey">29</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Unity預計算即時GI/">
                        <span class="tag">Unity預計算即時GI</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/VR-AR/">
                        <span class="tag">VR/AR</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/Vulkan/">
                        <span class="tag">Vulkan</span>
                        <span class="tag is-grey">3</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/iOS学习笔记/">
                        <span class="tag">iOS学习笔记</span>
                        <span class="tag is-grey">9</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/并发模型/">
                        <span class="tag">并发模型</span>
                        <span class="tag is-grey">5</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/杂记/">
                        <span class="tag">杂记</span>
                        <span class="tag is-grey">4</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/游戏设计模式/">
                        <span class="tag">游戏设计模式</span>
                        <span class="tag is-grey">8</span>
                    </a>
                </div>
                
                <div class="control">
                    <a class="tags has-addons" href="/tags/组成原理/">
                        <span class="tag">组成原理</span>
                        <span class="tag is-grey">6</span>
                    </a>
                </div>
                
            </div>
        </div>
    </div>
</div>
    
    
</div>

            </div>
        </div>
    </section>
    <footer class="footer">
    <div class="container">
        <div class="level">
            <div class="level-start has-text-centered-mobile">
                <a class="footer-logo is-block has-mb-6" href="/">
                
                    <img src="/images/logo.png" alt="iOS学习笔记-02集合" height="28">
                
                </a>
                <p class="is-size-7">
                &copy; 2021 蔡华&nbsp;
                Powered by <a href="https://hexo.io/" target="_blank">Hexo</a> & <a href="https://github.com/ppoffice/hexo-theme-icarus" target="_blank">Icarus</a>
                
                </p>
            </div>
            <div class="level-end">
            
            </div>
        </div>
    </div>
</footer>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.22.2/min/moment-with-locales.min.js"></script>
<script>moment.locale("zh-CN");</script>


    
    
    
    <script src="/js/animation.js"></script>
    

    
    
    
    <script src="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/js/lightgallery.min.js" defer></script>
    <script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js" defer></script>
    <script src="/js/gallery.js" defer></script>
    

    
    

<div id="outdated">
    <h6>Your browser is out-of-date!</h6>
    <p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update
            my browser now </a></p>
    <p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>
</div>
<script src="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js" defer></script>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'flex'
        });
    });
</script>


    
    
<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.5/unpacked/MathJax.js?config=TeX-MML-AM_CHTML" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
    MathJax.Hub.Config({
        'HTML-CSS': {
            matchFontHeight: false
        },
        SVG: {
            matchFontHeight: false
        },
        CommonHTML: {
            matchFontHeight: false
        },
        tex2jax: {
            inlineMath: [
                ['$','$'],
                ['\\(','\\)']
            ]
        }
    });
});
</script>

    
    

<a id="back-to-top" title="回到顶端" href="javascript:;">
    <i class="fas fa-chevron-up"></i>
</a>
<script src="/js/back-to-top.js" defer></script>


    
    

    
    
    
    

    
    
    
    
    
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.4/dist/clipboard.min.js" defer></script>
    <script src="/js/clipboard.js" defer></script>
    

    
    
    


<script src="/js/main.js" defer></script>

    
    <div class="searchbox ins-search">
    <div class="searchbox-container ins-search-container">
        <div class="searchbox-input-wrapper">
            <input type="text" class="searchbox-input ins-search-input" placeholder="想要查找什么...">
            <span class="searchbox-close ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="searchbox-result-wrapper ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: '文章',
                PAGES: '页面',
                CATEGORIES: '分类',
                TAGS: '标签',
                UNTITLED: '(无标题)',
            },
            CONTENT_URL: '/content.json',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script src="/js/insight.js" defer></script>
<link rel="stylesheet" href="/css/search.css">
<link rel="stylesheet" href="/css/insight.css">
    
</body>
</html>